<?php
	//Xay dung tim kiem
	$ssFilter 		= $this->arrParam['ssFilter'];
	
	$page = '';
	if(isset($this->arrParam['page'])){
		$page = '/page/' . $this->arrParam['page'];
	}
	$action_link 	= $this->baseUrl($this->currentController . '/filter/type/order');
	$lblName 		= $this->cmsLinkSort('Tên hội thảo','c.name',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblDiadiem  	= $this->cmsLinkSort('Địa điểm','c.diadem',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblSoluong  	= $this->cmsLinkSort('Số lượng người','c.soluongnguoi',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblMuctieu  	= $this->cmsLinkSort('Mục tiêu','c.muctieu',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblKetqua  	= $this->cmsLinkSort('Kết quả','c.ketqua',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblGia		  	= $this->cmsLinkSort('Giá vé','c.gia',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblNgaybatdau	= $this->cmsLinkSort('Ngày bắt đầu','c.date_start',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblNgayketthuc	= $this->cmsLinkSort('Ngày kết thúc','c.date_end',$ssFilter,$this->imgUrl . '/admin',$action_link);

	
	$lblID 			= $this->cmsLinkSort('ID','c.id',$ssFilter,$this->imgUrl . '/admin',$action_link);
	
	$lblStatus 		= $this->cmsLinkSort('Status','c.status',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblOrder 		= $this->cmsLinkSort('Order','c.order',$ssFilter,$this->imgUrl . '/admin',$action_link);
// 	$lblCategory	= $this->cmsLinkSort('Danh mục','category_name',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblhits		= $this->cmsLinkSort('Lượt xem','c.hits',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblLanguage	= $this->cmsLinkSort('Ngôn ngữ','c.lang_code',$ssFilter,$this->imgUrl . '/admin',$action_link);
	
	$keywords = $this->formText('keywords',$ssFilter['keywords'],array('class'=>'txtshort txtsearch'));
	
	//---------------------GROUP SELECTBOX --------------------//
// 	$linkSlbCategory = $this->baseUrl($this->currentController . '/filter/type/cat_id');
// 	$selectCategory = $this->cmsSelect('cat_id',$ssFilter['cat_id'],$this->slbCategory,array('style'=>'min-width:200px;','onchange'=>"OnSubmitForm('" .$linkSlbCategory ."')"));
	
	//---------------------SELECT BLOCKS --------------------//
	$linkBlocks = $this->baseUrl($this->currentController . '/filter/type/blocks');
	$slbBlocks = array(
						'0' => '- Bài viết thuộc Block -',
						'block_noibat'=> 'Tin nổi bật',
						'block_hot'=> 'Tin hot',
					);
	$selectBlocks = $this->formSelect('blocks',$ssFilter['blocks'],array('onchange'=>"OnSubmitForm('" .$linkBlocks ."')"),$slbBlocks);
	
	$selectLanguages = $this->slbLanguages;
	$linkSlbLanguages = $this->baseUrl($this->currentController . '/filter/type/lang');
	$selectLanguages = $this->formSelect('lang_code',$ssFilter['lang_code'],array('onchange'=>"OnSubmitForm('" .$linkSlbLanguages ."')"),$selectLanguages);
	
	$linkSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/1');
	$btnSearch = $this->formButton('search-now','Tìm',array('class' => 'btnsearch', 'onclick'=>"OnSubmitForm('" .$linkSearch . "')"));
	
	$linkResetSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/0');
	$btnResetSearch = $this->formButton('clear-keywords','Xóa',array('class' => 'btnsearch', 'onclick'=>"OnSubmitForm('" .$linkResetSearch ."')"));
	
	$strSearch = $keywords . ' ' . $btnSearch . ' ' . $btnResetSearch;

	//$strSearchRight = $selectBlocks . ' ' . $selectCategory . ' ' . $selectLanguages;
	$strSearchRight = $selectLanguages;
?>

<div class="left_content">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/left.php');?>
</div>
<div class="right_content">
	<div class="block_breadcrumb">
		<?php echo $this->blkBreadcrumbs('default'); ?>
	</div>
	<div class="appContent">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/index.php');?>
		
	<form action="" method="post" name="appForm">
	<script>
	$(function() {
	$( "#tabs" ).tabs();
	});
	</script>
	<div id="tabs">	
	<ul>
	<li><a href="#tabs-1">Danh sách Hội thảo</a></li>
	</ul>		
	<div id="tabs-1">
	<div class="tblForm">
	
		
		<div class="formList goc5">
			<div class="appTop goct5">
				<div class="block_filter">
					<div class="fl">
						<div class="listSearch">
							<?php echo $strSearch; ?>
							<div class="clr"></div>			
						</div>
					</div>
					<div class="clr"></div>
				</div>
			</div>
			<div class="appBody">
				<table class="tblList">
					<tr>
						<th><a href="">#</a></th>
						<th width="20"><input type="checkbox" name="checkbox" id="checkbox" onclick="checkedAll()"></th>
						<th><a href=""><?php echo $lblName;?></a></th>
						<th><a href=""><?php echo $lblDiadiem;?></a></th>
						<th><a href=""><?php echo $lblSoluong; ?></a></th>
						<th><a href=""><?php echo $lblGia;?></a></th>
						<th><a href=""><?php echo $lblNgaybatdau; ?></a></th>
						<th><a href=""><?php echo $lblNgayketthuc; ?></a></th>
						<th><a href="">Status</a></th>
						<th><a href="">Thao tác</a></th>
						<th><a href="">ID</a></th>
					</tr>
					
					<?php
				foreach ($this->Items as $key => $val){
					$id 			= $val['id'];
					$name	 		= $val['name'];
					$diadiem 		= $val['diadiem'];
					$soluongnguoi	= $val['soluongnguoi'];
					
					$gia			= $val['gia'];
					$ngaybatdau		= $val['date_start'];
					$ngayketthuc	= $val['date_end'];
					$status 		= $val['status'];
					if($status == 1){
						$status= 'Chưa thực hiện';
					}elseif ($status==2) {
						$status= 'Đang thực hiện';
					}elseif ($status==3){
						$status= 'Đã thực hiện';
					}else{
						$status= 'Chưa thực hiện';
					}
					
					
// 					if($status == 1){
// 						$linkStatus = $this->baseUrl($this->currentController . '/status/type/0/id/' . $id . $page);
// 						$status = $this->cmsIconButton('Kích vào để tắt', $this->imgUrl . '/admin/tick.png', $linkStatus);
// 					}else{
// 						$linkStatus = $this->baseUrl($this->currentController . '/status/type/1/id/' . $id . $page);
// 						$status = $this->cmsIconButton('Kích vào để bật', $this->imgUrl . '/admin/publish_x.png', $linkStatus);
// 					}
						
					//$linkInfo		= $this->baseUrl($this->currentController . '/info/id/' . $id . $page);
					$linkInfo		= '';
					$btnInfo		= $this->cmsIconButton('Xem thông tin', $this->imgUrl . '/admin/icon_info.png', $linkInfo);
					
					$linkEdit		= $this->baseUrl($this->currentController . '/edit/id/' . $id . $page);
					$btnEdit		= $this->cmsIconButton('Sửa', $this->imgUrl . '/admin/icon_edit.png', $linkEdit);
					
					$linkDelete		= $this->baseUrl($this->currentController . '/delete/id/' . $id . $page);
					$btnDelete		= $this->cmsIconButton('Xóa', $this->imgUrl . '/admin/publish_r.png', $linkDelete);
					  
					$strIconButton 	= $btnInfo . ' ' . $btnDelete;
					
					$alias = '<p class="smallsub">(Url: ' . $val['url'] . ' )</p>';
					$hoten 	= '<b><a href="' . $linkInfo . '">' . $hoten . '</a></b>';
				
					$cid 			= $this->formCheckbox('cid[]',$val['id']);
					
					$classRow = 'row1';
					if($key % 2 == 0)
					$classRow = 'row0';
						
			?>
			<tr class="<?php echo $classRow;?>">
				<td align="center"><?php echo $key + 1;?></td>
				<td align="center"><?php echo $cid;?></td>
				<td align="left"><b><a href="<?php echo $linkEdit;?>"><?php echo $name;?></a></b></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $diadiem;?></a></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $soluongnguoi;?></a></td>
				
				<td align="center"><a class="right" href="<?php echo $linkEdit;?>"><span class="auto_numberic red right" ><?php echo $gia;?></span></a></td>
				<td align="center"><a href="<?php echo $linkEdit;?>"><?php echo $ngaybatdau;?></a></td>
				<td align="center"><a href="<?php echo $linkEdit;?>"><?php echo $ngayketthuc;?></a></td>
				<td align="center"><?php echo $status;?></td>
				<td align="center"><?php echo $strIconButton;?></td>
				<td align="center"><?php echo $id;?></td>
			</tr>
			<?php
				} 
			?>
					
					<!-- 
					<tr>
						<td align="center"><input type="checkbox" value="598" class="checkbox" name="cid[]"></td>
						<td align="left"><a href="">Nguyễn Văn Nam</a></td>
						<td align="left">0902 171 042</td>
						<td align="left"><a href="">namtin17@gmail.com</a></td>
						<td align="center"><img src="<?php //echo $this->imgUrl . '/menu/icon-16-flag-active.png'; ?>"></td>
						<td align="left">Nhóm kinh doanh</td>
						<td align="left">Độ nóng</td>
						<td align="center">27/10/2013 15:03:53</td>
						<td align="left">
							<a href=""><img title="Sửa" src="<?php //echo $this->imgUrl . '/admin/icon_edit.png'; ?>"></a>
							<a href=""><img title="Xóa" src="<?php //echo $this->imgUrl . '/admin/icon_del.png'; ?>"></a>
						</td>
					</tr>
					 -->
				</table>
			</div>
			<div class="appBottom">
				<div class="pagination">
							<?php
								$currentUrl = $this->baseUrl($this->currentController . '/index');
								echo $this->paginationControl($this->paginator,'Sliding','pagination.phtml',array('currentUrl'=>$currentUrl)); 
							?>
					
				</div>
			</div>
		</div>
	</div>
	</div>
	</div>
	</form>
	</div>
</div>
<div class="clr"></div>	
